import Vue from 'vue'
import VueRouter from 'vue-router'


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: () =>import('../views/Login.vue'),
    meta:{
      tilte:'登录页'
    },
  },
  {
    path: '/rou',
    name: 'rou',
    component: () =>import('../views/Rou.vue'),
    meta:{
      tilte:'注册页'
    },
  },
  {
    path: '/yong',
    name: 'yong',
    component: () =>import('../views/Yong.vue'),
    meta:{
      tilte:'登录页'
    },
  },
  {
    path: '/recommend',
    name: 'Index',
    component: () =>import('../views/Index.vue'),
    children:[{
      path: '/recommend',
      name: 'recommend',
      component: () =>import('../views/index/Recommend.vue'),
      meta:{
        tilte:'今日歌曲推荐'
      },
    },{
      path: '/hot',
      name: 'hot',
      component: () =>import('../views/index/Hot.vue'),
      meta:{
        tilte:'Hot热歌榜'
      }
    },{
      path: '/search',
      name: 'search',
      component: () =>import('../views/index/Search.vue'),
      meta:{
        tilte:'搜你心中所想'
      }
    },],
  },
  {
    path: '/home',
    name: 'home',
    component: () =>import('../views/Home.vue'),
    meta:{
      tilte:'个人主页'
    }
  },
  {
    path: '/down',
    name: 'down',
    component: () =>import('../views/Down.vue'),
    meta:{
      tilte:'下载'
    }
  },
  {
    path: '/aulbm',
    name: 'aulbm',
    component: () =>import('../views/Aulbm.vue'),
    meta:{
      tilte:'下载'
    }
  },
  {
    path: '/details',
    name: 'details',
    component: () =>import('../views/Details.vue'),
    meta:{
      tilte:'下载'
    }
  },
  {
    path: '/bo',
    name: 'bo',
    component: () =>import('../views/Bo.vue'),
    meta:{
      tilte:'播放'
    }
  },
  {
    path: '/full',
    name: 'full',
    component: () =>import('../views/Full.vue'),
    meta:{
      tilte:'播放'
    }
  },
 
]

const router = new VueRouter({
  'linkActiveClass':'active',
  routes,
})

// 路由辕信息
// router.beforeEach((to,from,next) =>{
//  if(to.path==='/') return next()
//  const token = window.localStorage.getItem('x-token')
//  if(!token) return next('/')
//  next()
// })

export default router
